/*
 * Date：10/23/18 10:08 PM
 * Author: guomw
 *
 */

package org.elanfox.intellicommunity.biz.repository.resident;

import org.elanfox.intellicommunity.biz.entity.resident.WorkerPO;
import org.elanfox.intellicommunity.data.base.base.JpaSearchableRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 工作Repository
 *
 * @author loutianxi
 * @date 2019-12-04
 */
@Repository
public interface WorkerRepository extends JpaSearchableRepository<WorkerPO, Integer> {
    long countByOrganization_OrgId(Integer orgId);

    List<WorkerPO> findByStewardIsTrue();

    @Query(nativeQuery = true, value =
            "select b.* from t_worker_structure a LEFT JOIN t_worker b on a.work_id=b.work_id where a.structure_id=:structureId")
    List<WorkerPO> findWorkByStrId(@Param("structureId") Integer structureId);
}
